package com.zt.location.modules.upload.controller;
 

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List; 

/*
** readCSV类：实现CSV文件内容的读取
 */
public class readCSV {

    // 参数：文件路径
    private String file_path;

    // 构造函数
    readCSV(){}

    readCSV(String file_path){
        this.file_path = file_path;
    }

    // getter and setter
    public String getFile_path() {
        return file_path;
    }

    public void setFile_path(String file_path) {
        this.file_path = file_path;
    }
 
    public List<String> read() { 
        List<String> result = new ArrayList<>(); 
        try {   
        	 FileReader reader = new FileReader(this.file_path);
        	 BufferedReader br = new BufferedReader(reader);
        	 String line;
			while ((line = br.readLine()) != null) { 
				// 一次读入一行数据 
				System.out.println(line);
				}
		} catch (IOException e) { e.printStackTrace(); } 
       return result;

    } 

}